package parser;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class VocabularyReader
{
	private static final VocabularyReader instance =  new VocabularyReader();
	
	private VocabularyReader()
	{
		
	}
	
	public static VocabularyReader getInstance()
	{
		return instance;
	}
	
	public List<String> read(InputStream inputStream) throws IOException
	{
		ArrayList<String> vocabulary = new ArrayList<String>();
		InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
		BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
		
		String line = bufferedReader.readLine();
		while (line != null)
		{
			vocabulary.add(line);
			line = bufferedReader.readLine();
		}
		return vocabulary;
	}
}
